#!/bin/bash

# Copyleft 2020 Jeff Cliff
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (like at COPYING.GPL).  If not, see <https://www.gnu.org/licenses/>.


MEMEDIR=/mnt/disk/meme
STERM='"'"${@:1}"'"'
TMPFILE=`mktemp`
DB=/home/themusicgod1/TDL/urls.db

echo $STERM
echo grep -i $STERM $MEMEDIR/*/*/*/people.txt ~/people.txt >> $TMPFILE
chmod 755 $TMPFILE
$TMPFILE
echo $TMPFILE
sqlite3 $DB -line "select url, rss, other, id from news where url like \"%"$TERM"%\"" | grep -i 'url' | awk -F' ' '{print $3}';
